﻿using ENMAX_ArcGIS;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Windows.Media;
using System.Windows.Markup;

using ESRI.ArcGIS.Client.Geometry;
using ESRI.ArcGIS.Client;

namespace ENMAX_ArcGIS_TestProject
{
    
    
    /// <summary>
    ///This is a test class for GhostFrameTest and is intended
    ///to contain all GhostFrameTest Unit Tests
    ///</summary>
    [TestClass()]
    public class GhostFrameTest
    {

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for UpdatePosition
        ///</summary>
        [TestMethod()]
        public void UpdatePositionTest()
        {
            ArcGisMap backgroundMap = new ArcGisMap();
            Envelope mapEnvelope = new Envelope(-114.184245496432, 51.0005649329704, -114.164776887767, 51.0101176615905);
            SolidColorBrush color = new SolidColorBrush(Colors.Red);
            GhostFrame target = new GhostFrame(backgroundMap, mapEnvelope, color);
            Envelope newEvelop = new Envelope(-114.15691902877, 51.0591195173411, -114.1102425907428, 51.0835361218838);
            target.UpdatePosition(newEvelop);
            Assert.AreEqual(target.Extent.XMax, newEvelop.XMax, "Update Failed");
            Assert.AreEqual(target.Extent.XMin, newEvelop.XMin, "Update Failed");
            Assert.AreEqual(target.Extent.YMax, newEvelop.YMax, "Update Failed");
            Assert.AreEqual(target.Extent.YMin, newEvelop.YMin, "Update Failed");
        }

        /// <summary>
        ///A test for GhostFrame Constructor
        ///</summary>
        [TestMethod()]
        public void GhostFrameConstructorTest()
        {
            ArcGisMap backgroundMap = new ArcGisMap();
            Envelope mapEnvelope = new Envelope(-114.184245496432, 51.0005649329704, -114.164776887767, 51.0101176615905);
            SolidColorBrush color = new SolidColorBrush(Colors.Red);
            GhostFrame target = new GhostFrame(backgroundMap, mapEnvelope, color);
            Assert.AreEqual(target.Extent.XMax, mapEnvelope.XMax, "Initialize Extent Failed");
            Assert.AreEqual(target.Extent.XMin, mapEnvelope.XMin, "Initialize Extent Failed");
            Assert.AreEqual(target.Extent.YMax, mapEnvelope.YMax, "Initialize Extent Failed");
            Assert.AreEqual(target.Extent.YMin, mapEnvelope.YMin, "Initialize Extent Failed");
            Assert.AreEqual(target.Background, color, "Initialize Color Frame Failed");
        }
    }
}
